<template>
    <el-dialog :visible.sync="visible" title="报名明细" width="1000px" :before-close="close">
        <div>
            <el-button type="primary" @click="exportExcel" v-if="$auth('export')">导出</el-button>
        </div>
        <el-table :data="list">
            <el-table-column label="用户名称" prop="user_name"></el-table-column>
            <el-table-column label="家庭成员名称" prop="family_name"></el-table-column>
            <el-table-column label="联系电话" prop="family_mobile"></el-table-column>
            <el-table-column label="付款金额" prop="total_price" width="140"></el-table-column>
            <el-table-column label="性别" width="120">
                <template slot-scope="{row}">
                    {{ row.sex == 1 ? '男' : '女' }}
                </template>
            </el-table-column>
            <el-talbe-column label="报名时间" prop="pay_time" width="140"></el-talbe-column>
        </el-table>
        <template #footer>
            <el-button @click="close">关闭</el-button>
        </template>
    </el-dialog>
</template>
<script>
import { get } from '@/assets/js/http'
export default {
    data() {
        return {
            list: [],
            visible: false,
            id:0
        }
    },
    methods: {
        open(list,id) {
            this.visible = true
            this.list = list
            this.id = id
        },
        close() {
            this.visible = false
            this.list = []
        },
        async exportExcel() {
            this.$loading()
            let res = await get({
                export: true,
                url: '/api/Realmerit/sign_family_export',
                params: {
                    id:this.id
                }
            })
            let a = document.createElement('a');
            var url = URL.createObjectURL(res);
            a.href = url;
            a.click();
            this.$loading().close()
        },
    }
}
</script>